package org.simple.framework.web.result.exception;

import lombok.Getter;
import org.simple.framework.web.result.base.SimpleResult;
import org.simple.framework.web.result.model.BaseCode;

/**
 * 项目名称：simple-web-result
 * 类名称：BaseSimpleException
 * 类描述：BaseSimpleException 可转为BaseResult的异常基类
 * 创建时间：2018/1/17 12:47
 *
 * @author sisyphus   (E-mail:1620657419@qq.com)
 * @version v1.0
 */
public class BaseSimpleException extends RuntimeException {

    @Getter
    protected SimpleResult baseResult;

    public BaseSimpleException(BaseCode baseErrorCode) {
        super(baseErrorCode.getMessage());
        baseResult = new SimpleResult(baseErrorCode);
    }

    public BaseSimpleException(BaseCode baseErrorCode, Object data) {
        super(baseErrorCode.getMessage());
        baseResult = new SimpleResult(baseErrorCode, data);
    }

}
